<?php

include 'init.php';

$admin = new Admin();
$admin->checkAdmin();

$entity = new EntityAdmin();
$data['entities'] = $entity->entitiesList();

if (!isset($_GET['table']))
{
    header("Location: index.php");
}

$entity->setEntityName($_GET['table']);

$data['names'] = $entity->showNames();
$data['entity'] = $entity->getViewName();
$data['table'] = $entity->showEntity();

$tpl = new TemplateAdmin('entity', $data);
$tpl->viewTemplate();
?>
